//
//  HJHWBStatusViewModel.swift
//  WeiBoPro
//
//  Created by nadyboy on 2018/5/21.
//  Copyright © 2018年 hjh. All rights reserved.
//

import Foundation
import YYModel
import MJExtension

class HJHWBStatusViewModel {
    
    var wbStatusArr = [HJHWBStatus]()
    
    ///首页数据加载
    func loadWBStatusData(isCompelete: @escaping (_ isComplete:Bool)->()){
        
        HJHHttpManager.shareInstance.requstAcceccToken(urlString: "https://api.weibo.com/2/statuses/home_timeline.json", paramters: nil) { (list, isSuccess) in
            
            guard let arrDic = list as? [String:Any] else{
                return
            }
            
            let arr = arrDic["statuses"] ?? []
            print(arr)
            let res = HJHWBStatus.mj_objectArray(withKeyValuesArray: arr) as! [HJHWBStatus]
            self.wbStatusArr += res
            isCompelete(isSuccess)
        }
    }
}
